package com.yutel.enums;

import java.util.EnumMap;
import java.util.Map.Entry;

public class Student {
	private Grade grade;

	public static void main(String[] args) {
		Student std = new Student();
		//std.setGrade(Grade.F);
		std.printEnum();
		//System.out.println(std.getGrade());
		//std.testSwitch(std.getGrade());
		//std.testEnum();
	}
	public void printEnum(){
		for(Grade g : Grade.values()){
			System.out.println("key="+g+",value="+g.getDay());
		}
	}
	public void testEnum(){
		EnumMap<Grade, String> gs =new EnumMap<Grade, String>(Grade.class);
		gs.put(Grade.A, "AAAAAAAAAAAA");
		gs.put(Grade.B, "BBBBBBBBBBBBB");
		gs.put(Grade.C, "CCCCCCCCCCCCC");
		gs.put(Grade.F, "DDDDDDDDDDD");
		for(Entry e : gs.entrySet()){
			System.out.println("key="+e.getKey()+",value="+e.getValue());
		}
	}
	public void testSwitch(Grade grade){
		switch (grade) {
		case A:
			System.out.println("excelled with a grade of A");
			break;
		case B: // fall through to C
		case C:
			System.out.println("passed with a grade of "
					+ grade.toString());
			break;
		case D: // fall through to F
		case F:
			System.out.println("failed with a grade of "
					+ grade.toString());
			break;
		case INCOMPLETE:
			System.out.println("did not complete the class.");
			break;
		}
	}

	public Grade getGrade() {
		return grade;
	}

	public void setGrade(Grade grade) {
		this.grade = grade;
	}

}
